#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;

const double eps = 1e-8;

#if 0
#define STDIN
#define DEBUG
#endif

class Point {
    public:
        double x;
        double y;

    public:
        Point() : x(0), y(0) {};
        Point(double x, double y) : x(x), y(y) {};
        Point(const Point& p) {
            this->x = p.x;
            this->y = p.y;
        }


        friend ostream& operator<<(ostream& os, const Point& pt);
        friend istream& operator>>(istream& in, Point& pt);
};

ostream& operator<<(ostream& os, const Point& pt) {
    os <<  setiosflags(ios::fixed) << setprecision(2) << pt.x << " " << pt.y;
    return os;
}
istream& operator>>(istream& in, Point& pt) {
    in >> pt.x >> pt.y;
    return in;
}

// 定义一条直线，这条直线有三个参数，用一般式：AX+BY+C=0。
// 所以这三个参数分别为A、B、C
// 使用线性代数的性质判断平等相交

class Line {
    public:
        Point pt1;
        Point pt2;

        double A;
        double B;
        double C;


    public:
        Line() {A = B = C = 0;};

        void computeABC() {
            A = pt1.y - pt2.y;
            B = -(pt1.x - pt2.x);
            C = -(A*pt1.x + B*pt1.y);
        }
        bool IsPointOnLine(const Point& pt) {
            if (B == 0) {
                return pt1.x == pt.x;
            } else {
                return A*pt.x + B*pt.y + C == 0;
            }
        }
        friend ostream& operator<<(ostream& os, const Line& l);
        friend bool IsParallel(const Line& l1, const Line& l2);
        friend Point* GetIntersectionPoint(const Line& l1, const Line& l2);
};

ostream& operator<<(ostream& os, const Line& l) {
    os << "begin: " << l.pt1 <<" end:   " << l.pt2;
    return os;
}

bool IsParallel(const Line& l1, const Line& l2) {
    return abs(l1.A*l2.B - l1.B*l2.A) < eps;
}

Point* GetIntersectionPoint(const Line& l1, const Line& l2) {
    double x = (l1.B*l2.C - l2.B*l1.C) / (l1.A*l2.B - l2.A*l1.B);
    double y = (l1.C*l2.A - l2.C*l1.A) / (l1.A*l2.B - l2.A*l1.B);
    return new Point(x, y);
}

Line l1;
Line l2;

void Process() {
    l1.computeABC();
    l2.computeABC();
#if defined(DEBUG)
    cout << "l1: " << l1 << endl;
    cout << "l2: " << l2 << endl;
    //cout << l1.A << " " << l1.B << " " << l1.C  << endl;
#endif
    if (IsParallel(l1, l2)) {
        if (l1.IsPointOnLine(l2.pt1)){
            cout << "LINE" << endl;
        } else {
            cout << "NONE" << endl;
        }
    } else {
        Point* section = GetIntersectionPoint(l1, l2);
        if (section) {
            cout << "POINT " <<*section << endl;
            delete section;
        }
    }
}

int main() {
    int N;
    cin >> N;
    cout << "INTERSECTING LINES OUTPUT" << endl;
    while(N--) {
        cin >> l1.pt1.x >> l1.pt1.y;
        cin >> l1.pt2.x >> l1.pt2.y;
        cin >> l2.pt1.x >> l2.pt1.y;
        cin >> l2.pt2.x >> l2.pt2.y;

        Process();
    }
    cout << "END OF OUTPUT" << endl;
    return 0;
}
